﻿using System;
using System.Runtime.InteropServices;

namespace Godot.core.math
{
    [StructLayout(LayoutKind.Explicit)]
    public struct Vector2
    {
		[FieldOffset(0)] public float x;
		[FieldOffset(0)] public float width;

		[FieldOffset(4)] public float y;
		[FieldOffset(4)] public float height;

        public static readonly Vector2 empty = new Vector2(0, 0);

        public Vector2(float p_x, float p_y)
        {
            x = width = p_x; y = height = p_y;
        }

        public static bool operator == (Vector2 p_v1, Vector2 p_v2)
        {
            return (p_v1.x == p_v2.x) && (p_v1.y == p_v2.y);
        }

        public static bool operator != (Vector2 p_v1, Vector2 p_v2)
        {
            return !((p_v1.x == p_v2.x) && (p_v1.y == p_v2.y));
        }

        public override bool Equals(object obj)
        {
            if (obj is Vector2)
            {
                return ((Vector2)obj) == this;
            }
            return base.Equals(obj);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
